package com.company.project.common.utils;

import java.util.Calendar;
import java.util.Date;

public class TimeUtils {
	public static boolean isNight() {
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(new Date());
		calendar.set(Calendar.HOUR_OF_DAY,0);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		Date zeroTime = calendar.getTime();
		calendar.setTime(new Date());
		calendar.set(Calendar.HOUR_OF_DAY,6);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		Date morning = calendar.getTime();
		Date now = new Date();
		if(now.after(zeroTime) && now.before(morning)) {
			return true;
		}else {
			return false;
		}
	}
}
